package com.prd.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.prd.dto.SysDeptDTO;
import com.prd.model.SysDeptDO;
import com.prd.service.SysDeptService;
import com.prd.util.CommonUtil;
import com.prd.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * <p>
 * 部门组织数据表 前端控制器
 * </p>
 *
 * @author lizhaoyi
 * @since 2024-01-04
 */
@RestController
@RequestMapping("/api/sysDept")
@Api(tags = "部门组织")
public class SysDeptController {

    @Autowired
    private SysDeptService sysDeptService;

    @ApiOperation("添加部门组织")
    @PostMapping("add")
    public JsonData add(@RequestBody SysDeptDTO sysDeptDTO){

        return sysDeptService.add(sysDeptDTO);
    }

    @ApiOperation("编辑")
    @PostMapping("editDept")
    public JsonData editDept(@RequestBody SysDeptDTO sysDeptDTO){

        return sysDeptService.editDept(sysDeptDTO);
    }


    @ApiOperation("移除")
    @PostMapping("delete")
    public JsonData delete(@ApiParam("部门id") @RequestParam Long id){

        return sysDeptService.delete(id);
    }

    @ApiOperation("部门组织列表")
    @GetMapping("selectList")
    public JsonData selectList(){

        return sysDeptService.selectList();
    }

    @ApiOperation("查询部门组织")
    @GetMapping("select")
    public JsonData select(@ApiParam("部门id") @RequestParam Long id){

        return sysDeptService.select(id);
    }

}

